<%-- 
    Document   : validar
    Created on : Jun 23, 2013, 3:20:20 PM
    Author     : daniel-mysql
--%>

<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.DriverManager"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%
  try{
    String carnet = (String)request.getParameter("carnet");
    String pass = (String) request.getParameter("pass");
    Class.forName("com.mysql.jdbc.Driver");
    Connection c = DriverManager.getConnection("jdbc:mysql://192.168.43.225:3306/usuario","usuario","1234");
    Statement consulta = (Statement) c.createStatement();
    ResultSet resultado = consulta.executeQuery("select * from usuario where carnet = " + carnet +" password "+ pass );
    boolean lleno = resultado.next();
    if(!lleno){
       response.sendRedirect("index.jsp?error=no");
    }
 }catch(Exception e){
    out.print(e.getMessage());
 }   
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Fase3 :: Success</title>
        <style></style>
        <script></script>
    </head>
    <body>
        <h1>Usuario Existente</h1>
        <a href="index.jsp">Regresar</a>
    </body>
</html>
